package example.day02;

/**
 * @author 涛哥
 * @nick_name "deep as the sea"
 * @contact qq:657270652 wx:doit_edu
 * @site www.doitedu.cn
 * @date 2021-03-02
 * @desc 位移运算符示例代码
 */
public class _06_BitShift位移运算Demo {
    public static void main(String[] args) {

        int x1 = 4;
        System.out.println( x1 << 2);

        int x2 = -4;
        System.out.println(x2 << 2);

        int y1 = 16;
        System.out.println(y1 >> 2);

        int y2 = -16;
        System.out.println(y2 >> 2);

        // 无符号右移
        System.out.println(y1 >>> 2);
        System.out.println(y2 >>> 2);

    }
}
